<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>浏览器的弹出层</title>
</head>
<body>
  <button id="on">去百度</button>
  <button id="off">关闭网页</button>
<script>
  //弹出警告框
  window.alert("hello");
  //弹出询问框
  var res = window.confirm("你喜欢我吗？");
  console.log(res);
  //弹出信息框
  var rse = window.prompt("请说作者是个大帅哥");
  console.log(rse);
  //开启和关闭页签 onclick是点击事件
  on.onclick = function () {
      window.open("https://www.baidu.com")
  }

  //关闭页签
  off.onclick = function () {
      window.close();
  }
</script>
</body>
</html>